package com.software.loginregister.activity;

import androidx.appcompat.app.AppCompatActivity;

import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.software.loginregister.R;

public class AboutUsActivity extends AppCompatActivity {

    private ImageView btnBack;
    private TextView btnFeedback;
    private TextView emailContent;
    private TextView telContent;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_about_us);

        initViews();
        setupListeners();
    }

    private void initViews() {
        btnBack = findViewById(R.id.btn_about_us_back);
        emailContent = findViewById(R.id.email_content);
        telContent = findViewById(R.id.tel_content);
    }

    private void setupListeners() {
        // 返回按钮点击事件
        btnBack.setOnClickListener(v -> finish());

        // 邮箱点击复制
        emailContent.setOnClickListener(v -> {
            ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
            ClipData clip = ClipData.newPlainText("email", emailContent.getText().toString());
            clipboard.setPrimaryClip(clip);
            Toast.makeText(this, "邮箱已复制", Toast.LENGTH_SHORT).show();
        });

        // 电话点击拨打
        telContent.setOnClickListener(v -> {
            String tel = telContent.getText().toString();
            Intent intent = new Intent(Intent.ACTION_DIAL);
            intent.setData(Uri.parse("tel:" + tel));
            startActivity(intent);
        });
    }
}